<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-7-20
 * Time: 上午11:43
 */

namespace ActionsHttp;


use Data\Statistics_restaurant_day_turnover_DAO;
use Utils\StatisticsRestaurant;

class RestaurantStatisticsBusiness extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;

        // 今天零点时间戳
        $today_time = strtotime(date('Ymd'));
        // 昨天零点时间戳
        $yesterday_time = $today_time-86400;
        // 昨天日期
        $yesterday_date = date("Y-m-d",$yesterday_time);


        $search_type = $this->data[SEARCH_TYPE];

        switch ($search_type)
        {
            case SEARCH_DAY:
                $statistics_business_day = Statistics_restaurant_day_turnover_DAO::getTurnoverRecord($restaurant_id,$yesterday_date);

                // 返回数据
                $this->setValue(STATISTICS_BUSINESS_DAY,$statistics_business_day);
                $this->ResponseDataToCurrentClient();
                break;
        }
    }
}